package com.mall.goods.controller;

import com.mall.goods.model.Category;
import com.mall.goods.service.CategoryService;
import com.mall.util.RespResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: ljr
 * @time: 2021/9/5 14:58
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @GetMapping("/findListByParentId")
    public RespResult<List<Category>> findListByParentId(@RequestParam String pId){
        List<Category> categories = categoryService.findList(pId);
        return RespResult.ok(categories);
    }



}
